clear
capture log close
set more off
use Couples1970

keep statefip metarea age age_m race_m hispan_m educd_m hispan_m incwage_m qsex_m qeduc_m qocc_m qincwage_m qocc agemarr agemarr_m marrno marrno_m hwage_m qage qage_m

keep if qage==0
keep if qage_m==0
keep if qsex_m==0
keep if qeduc_m==0
keep if qincwage_m==0
keep if qocc_m==0

replace incwage_m=incwage_m*172.2/38.8
replace hwage_m=hwage_m*172.2/38.8
gen urban=(metarea==0)
gen white_m=(race_m==1&hispan_m==0)
gen black_m=(race_m==2&hispan_m==0)
gen hisp_m=(hispan_m!=0)
gen nohs_m=(educd_m<60)
gen hs_m=(educd_m>=60& educd<100)
gen coll_m=(educd_m==100)
gen adv_m=(educd_m>100)

gen agediff=age_m-age
gen pos=(agediff>0)
gen agediffpos=agediff*pos
gen agediffneg=agediff*(1-pos)*(-1)
gen ap1=(agediffpos>=2&agediffpos<=4)
gen ap2=(agediffpos>=5&agediffpos<=7)
gen ap3=(agediffpos>=8)
gen an1=(agediffneg>=2&agediffneg<=4)
gen an2=(agediffneg>=5&agediffneg<=7)
gen an3=(agediffneg>=8)

gen stfips=urban*100+statefip
tab stfips, gen(stu)

tab age_m, gen(hfe)
gen hagehs=age_m*hs_m
tab hagehs, gen(hhsfe)
gen hagecoll=age_m*coll_m
tab hagecoll, gen(hcollfe)
gen hageadv=age_m*adv_m
tab hageadv, gen(hadvfe)

keep if marrno_m==1
gen marr2=(marrno==2)
gen marr3=(marrno>=3)
gen agem2=agemarr_m*agemarr_m

keep if hwage_m !=0
keep if hwage_m !=.

log using Tab3_men_1970_col3col4.log, replace

reg hwage_m ap1 ap2 ap3 an1 an2 an3 agemarr_m agem2 marr2 marr3 white_m black_m hisp_m stu* hfe* hhsfe* hcollfe* hadvfe*, robust
tobit incwage_m ap1 ap2 ap3 an1 an2 an3 agemarr_m agem2 marr2 marr3 white_m black_m hisp_m stu* hfe* hhsfe* hcollfe* hadvfe*, ll(0) robust

log close



